<?php

include_once 'connection/connection_database.php';

class questions {
    function Delete($question_id){
        $sql = "DELETE FROM question WHERE question_id={$question_id["id"]}";
        return mysql_query($sql) or die(mysql_error());
    }
    
    function FillAll(){
        $sql = "SELECT * FROM question WHERE question_status=0";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function FillAllAccecpt(){
        $sql = "SELECT * FROM question WHERE question_status=1";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function FillOne($question){
        $sql = "SELECT * FROM question WHERE question_id={$question["id"]}";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function Update($question){
        $sql = "UPDATE question SET re_question='{$question["re_question"]}', question_status=1 WHERE question_id={$question["id"]}";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
    
    function UnAccept($question){
        $sql = "UPDATE question SET question_status=0 WHERE question_id={$question["id"]}";
        $result = mysql_query($sql) or die(mysql_error());
        return $result;
    }
}

?>
